//
//  UIBarButtonItem+XMGButtonItem.m
//  百思不得姐
//
//  Created by 杨庆 on 2016/12/30.
//  Copyright © 2016年 杨庆. All rights reserved.
//

#import "UIBarButtonItem+XMGButtonItem.h"

@implementation UIBarButtonItem (XMGButtonItem)

+(instancetype)itemWithImage:(NSString*)image highImage:(NSString*)highImage target:(id)target action:(SEL)selctor{

	//封装 UIBarButtonItem的创建,使其创建出来的时候就带有一个按钮,并且能够监听点击事件
	UIButton*btn=[UIButton buttonWithType:UIButtonTypeCustom];
	[ btn setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
	[ btn setImage:[UIImage imageNamed:highImage] forState:UIControlStateHighlighted];
	[btn addTarget:target action:selctor forControlEvents:UIControlEventTouchUpInside];
	[btn sizeToFit];
	return [[self alloc]initWithCustomView:btn];
	
}





@end
